// Copyright (C) 2008 Taylor L. Riche <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//

/**
 * 
 */
package appcomp.entities;

import core.CodeGenerator;
import core.Entity;
import java.net.URI;

/**
 * @author riche
 *
 */
public class Type extends Entity {

	private final String name;
	private final URI fileURI;
	private final String coreType;
	
	/**
	 * @param name
	 * @param fileURI
	 * @param coreType
	 */
	protected Type(final String name, final URI fileURI, final String coreType) {
		this.name = name;
		this.fileURI = fileURI;
		this.coreType = coreType;
	}
	
	public static Type create(String n, URI f, String c) {
		return new Type(n, f, c);
	}

	/**
	 * @return the coreType
	 */
	public String getCoreType() {
		return coreType;
	}

	/**
	 * @return the fileURI
	 */
	public URI getFileURI() {
		return fileURI;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Type other = (Type) obj;
		if (coreType == null) {
			if (other.coreType != null)
				return false;
		} else if (!coreType.equals(other.coreType))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}

	/* (non-Javadoc)
	 * @see core.Entity#generateCode(core.CodeGenerator)
	 */
	@Override
	public void generateCode(CodeGenerator cg) {
	}

}
